package cn.myjerry.sort.col;

import java.util.TreeMap;

public class TreeMapDemo {
	public static void main(String[] args) {
		Person p1 = new Person("张学友",150);
		Person p2 = new Person("周杰伦",80);
		Person p3 = new Person("成龙",110);
		Person p4 = new Person("房祖名",100);
		
		TreeMap<Person, String> persons = new TreeMap<Person, String>(
				new java.util.Comparator<Person>(){
					@Override
					public int compare(Person o1, Person o2) {
						return o1.getHandsome() - o2.getHandsome();
					}					
				}
				);
		persons.put(p1, "Jerry");
		persons.put(p2, "Jerry");
		persons.put(p3, "Jerry");
		persons.put(p4, "Jerry");
		System.out.println(persons.keySet());
	}
}
